# Maintainer: Ignacio Casal Quinteiro <icq@gnome.org>

_realname=libgusb
_tarballname=gusb
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.2.8
pkgrel=1
arch=('any')
pkgdesc="GLib wrapper around libusb1 (mingw-w64)"
depends=("${MINGW_PACKAGE_PREFIX}-libusb"
         "${MINGW_PACKAGE_PREFIX}-glib2")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-pkg-config"
             "${MINGW_PACKAGE_PREFIX}-vala"
             "${MINGW_PACKAGE_PREFIX}-gobject-introspection")
options=('strip' 'staticlibs')
license=("LGPL")
url="https://github.com/hughsie/libgusb"
source=("https://github.com/hughsie/${_realname}/archive/${_tarballname}_${pkgver//./_}.tar.gz")
sha256sums=('ed924b1e1a8fd1da6008b129cad57cf711b1f718785c08d74671304e97f7d2cd')

prepare() {
  cd "${srcdir}"/${_realname}-${_tarballname}_${pkgver//./_}
  gtkdocize
  autoreconf -f -i
}

build() {
  mkdir -p build-${MINGW_CHOST}
  cd build-${MINGW_CHOST}

  ../${_realname}-${_tarballname}_${pkgver//./_}/configure \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --build=${MINGW_CHOST} \
    --prefix=${MINGW_PREFIX} \
    --libexecdir=${MINGW_PREFIX}/lib \
    --enable-introspection

  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR=${pkgdir} install
}
